<?php
include('../../inc/global.inc');
include("../islogin.php");
$url=$_SERVER['HTTP_REFERER'];
?>
<?php
if($_POST['act_xg']){

$c_rs_1=mysql_query("select * from jm_catalog where id='$_POST[catalog_1]'");
$c_row_1=mysql_fetch_array($c_rs_1);
$c_rs_2=mysql_query("select * from jm_catalog where id='$_POST[catalog_2]'");
$c_row_2=mysql_fetch_array($c_rs_2);
$catalog_1=($_POST[catalog_1])?$_POST[catalog_1]:0;
$catalog_2=($_POST[catalog_2])?$_POST[catalog_2]:0;
$j_sh=($_POST[j_sh])?$_POST[j_sh]:0;

@mysql_query("update jm_list set j_title='$_POST[j_title]',type_id1='$catalog_1',type_name1='$c_row_1[cat_name]',type_id2='$catalog_2',type_name2='$c_row_2[cat_name]',j_info='$_POST[info]',picture='$_POST[picture]',j_pinpai='$_POST[pinpai]',j_price='$_POST[price]',j_bzj='$_POST[bzj]',j_ztze='$_POST[ztze]',j_ppfyd='$_POST[ppfyd]',j_ppls='$_POST[ppls]',j_qdl='$_POST[qdl]',j_fhqx='$_POST[fhqx]',j_scjhje='$_POST[scjhje]',j_ghzl='$_POST[ghzl]',j_fzms='$_POST[fzms]',j_hzfs='$_POST[hzfs]',j_ghzk='$_POST[ghzk]',j_khhbl='$_POST[khhbl]',j_lsjgdw='$_POST[lsjgdw]',j_mbxfqt='$_POST[mbxfqt]',j_yjhbl='$_POST[yjhbl]',j_yjhbzq='$_POST[yjhbzq]',j_txqsyf='$_POST[txqsyf]',j_htqx='$_POST[htqx]',j_jmszs='$_POST[jmszs]',j_txjysj='$_POST[txjysj]',j_cl=1,j_sh='$j_sh' where id='".$_POST['iid']."'");


echo "<script>alert('提交成功');location='".$_POST['urls']."';</script>";
}
?>
<HTML>
<HEAD>
<TITLE>Admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
<script type='text/javascript' src="../js/shijian.js"></script>
</HEAD>
<BODY>
<center>
<script language = "JavaScript">    
<?php
$rs1=mysql_query("select * from jm_catalog order by id asc");
?>
var onecount;
onecount=0;
subcat=new Array();
<?php
$count1=0;
while($row1=mysql_fetch_array($rs1)){?>
subcat[<?=$count1?>]=new Array("<?=$row1[cat_name]?>","<?=$row1[cat_id]?>","<?=$row1[id]?>");
<?php
$count1=$count1+1;}?>
onecount=<?=$count1?>;  
//联动函数    
function changelocation(locationid){   
   document.form1.catalog_2.length=0;     
   var locationid=locationid;   
   var i;   
   for(i=0;i<onecount;i++){   
       if(i==0){     
          document.form1.catalog_2.options[document.form1.catalog_2.length]=new Option("--二级分类--","");
		  }   
       if(subcat[i][1]==locationid){     
          document.form1.catalog_2.options[document.form1.catalog_2.length]=new Option(subcat[i][0],subcat[i][2]);   
          }                   
    }   
}
</script>
  <table width="780" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">代理加盟信息&nbsp;&nbsp;<a href="javascript:history.go(-1)">返回</a></td>
    </tr>
  </table>
<?php
$sql="select * from jm_list where id=".$_GET['xg_id'];
$rs=mysql_query($sql);
$row=mysql_fetch_array($rs)
?>
<TABLE width="780" border="0" cellpadding="0" cellSpacing="1" bgcolor="#000000">
        <TBODY>
        <form method="post" action="" name="form1">
	 <tr>
        <td align="center" bgcolor="#8DA8CF" colspan="2" height="45"><span style="padding-left:5px;">代理加盟信息</span></td>
      </tr>
	 <TR>
            <td width="17%" height="25" align="center" bgcolor="#eff6ff">代理加盟标题&nbsp;<font color="#FF0000">*</font></td>
            <TD width="83%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="j_title" id="j_title" value="<?=$row[j_title]?>" type="text" size="50" maxlength="120"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">代理加盟目录<span style="padding-left:4px;line-height:35px;">&nbsp;<font color="#FF0000">*</font></span></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;line-height:35px;">

<select name="catalog_1" id="catalog_1" onChange="changelocation(document.form1.catalog_1.options[document.form1.catalog_1.selectedIndex].value)">
 <option value="">--选择大类--</option>   
<?php
$rrs=mysql_query("select id,cat_name from jm_catalog where cat_id=0 order by id asc");    
while($rrow=mysql_fetch_array($rrs)){   
?>     
 <option value="<?=$rrow[id]?>" <?php if($row[type_id1]==$rrow[id]){echo "selected";}?>><?=$rrow[cat_name]?></option><?php }?>
</select>&nbsp;<select name="catalog_2" id="catalog_2" onFocus="changelocation(document.form1.catalog_1.options[document.form1.catalog_1.selectedIndex].value)">
  <option value="">--选择二级分类--</option>
  <?php if($row[type_id2]){?>
    <option value="<?=$row[type_id2]?>" selected="selected"><?=$row[type_name2]?></option>
  <?php }?>
</select></TD>
          </TR>		  
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">描述&nbsp;<font color="#FF0000">*</font></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><textarea name="info" id="info" cols="70" rows="20"><?=$row[j_info]?></textarea></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">图片</td>
            <TD bgcolor="#F9F9F9" style="padding:4px;line-height:30px;"><input name="picture" id="picture" type="text" size="35" maxlength="100" value="<?=$row[picture]?>">&nbsp;&nbsp;<input name="button" type="button" onClick="window.open ('../upfile.php', 'newwindow', 'height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')" value="上传图片">
              (图片限制140*104)<br>
              <input type="button" onClick="window.open ('/member/photo/info.php', 'newwindow', 'height=500, width=600, top=0, left=250, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')" value="选择已上传的图片"></TD>
          </TR>
		  <TR>
            <td height="25" colspan="2" align="left" bgcolor="#8DA8CF"><STRONG>&nbsp;&nbsp;参数</STRONG></td>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">产品品牌</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="pinpai" id="pinpai" value="<?=$row[j_pinpai]?>" type="text" size="20" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">加盟费</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><select name="price" id="price">
			 <option value="">--选择金额--</option>
		     <option value="免费" <?php if($row[j_price]=="免费"){echo "selected";}?>>免费</option>
		     <option value="0-1万" <?php if($row[j_price]=="0-1万"){echo "selected";}?>>0-1万</option>
		     <option value="1-5万" <?php if($row[j_price]=="1-5万"){echo "selected";}?>>1-5万</option>
		     <option value="5-10万" <?php if($row[j_price]=="5-10万"){echo "selected";}?>>5-10万</option>
		     <option value="10-25万" <?php if($row[j_price]=="10-25万"){echo "selected";}?>>10-25万</option>
		     <option value="25-40万" <?php if($row[j_price]=="25-40万"){echo "selected";}?>>25-40万</option>
		     <option value="50万以上" <?php if($row[j_price]=="50万以上"){echo "selected";}?>>50万以上</option>
        </select></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">保证金额</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="bzj" id="bzj" value="<?=$row[j_bzj]?>" type="text" size="10" maxlength="5">            
            万元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">总投资额</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ztze" id="ztze" type="text"  value="<?=$row[j_ztze]?>" size="10" maxlength="6">万元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">品牌发源地</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ppfyd" id="ppfyd"  value="<?=$row[j_ppfyd]?>" type="text" size="20" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">品牌历史</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ppls" id="ppls" value="<?=$row[j_ppls]?>" type="text" size="10" maxlength="3">
            年</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">起 订 量</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="qdl" id="qdl" value="<?=$row[j_qdl]?>" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">发货期限</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="fhqx" id="fhqx" value="<?=$row[j_fhqx]?>" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">首次进货金额</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="scjhje" id="scjhje" value="<?=$row[j_scjhje]?>" type="text" size="10" maxlength="5">
            万元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">供货总量</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ghzl" id="ghzl" value="<?=$row[j_ghzl]?>" type="text" size="10" maxlength="8"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">发展模式</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="fzms" id="fzms" value="<?=$row[j_fzms]?>" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="19" align="center" bgcolor="#eff6ff">合作方式</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="hzfs" id="hzfs" value="<?=$row[j_hzfs]?>" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">供货折扣</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ghzk" id="ghzk"  value="<?=$row[j_ghzk]?>" type="text" size="10" maxlength="6">
            折</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">可换货比率</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="khhbl" id="khhbl" value="<?=$row[j_khhbl]?>"  type="text"  size="10" maxlength="10"></TD>
          </TR>
		  
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">零售价格定位</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="lsjgdw" id="lsjgdw" value="<?=$row[j_lsjgdw]?>"  type="text" size="10" maxlength="8">
            元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">目标消费群体</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="mbxfqt" id="mbxfqt" value="<?=$row[j_mbxfqt]?>" type="text" size="15" maxlength="8"> 年龄段</TD>
          </TR>		  		  
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">预计回报率</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="yjhbl" id="yjhbl" value="<?=$row[j_yjhbl]?>" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">预计回报周期</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="yjhbzq" id="yjhbzq" value="<?=$row[j_yjhbzq]?>" type="text" size="20" maxlength="10"></TD>
          </TR>			  
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">特许权使用费</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="txqsyf" id="txqsyf" value="<?=$row[j_txqsyf]?>" type="text" size="20" maxlength="8"></TD>
          </TR>
		  
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">合同期限</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="htqx" id="htqx"  value="<?=$row[j_htqx]?>" type="text" size="10" maxlength="5"></TD>
          </TR>	
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">加盟商总数</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="jmszs" id="jmszs"  value="<?=$row[j_jmszs]?>" type="text" size="10" maxlength="6"></TD>
          </TR>	
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">特许经营时间</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="txjysj" id="txjysj" value="<?=$row[j_txjysj]?>" type="text" size="10" maxlength="5"></TD>
          </TR>	
		  <TR>
            <td height="25" colspan="2" align="left" bgcolor="#8DA8CF"><STRONG>&nbsp;&nbsp;管理员操作</STRONG></td>
          </TR> 
	 <tr>
	   <td height="25" align="center" bgcolor="#eff6ff">审核通过</td>
	   <td bgcolor="#ffffff" style="padding-left:3px;"><input type="radio" name="j_sh" value="1" <?php if($row[j_sh]==1){echo "checked";}?>>是<input type="radio" name="j_sh" value="0" <?php if($row[j_sh]==0){echo "checked";}?>>否</td>
      </tr> 		  		  		  
          <TR>
            <td height="25" align="center" bgcolor="#eff6ff">&nbsp;</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input type="submit" value=" 提 交 ">
            <input type="hidden" name="iid" value="<?=$row['id']?>"><input type="hidden" name="urls" value="<?=$url?>"><input type="hidden" name="iid" value="<?=$row['id']?>">
        <INPUT type="hidden" value="ok" name="act_xg"></TD>
          </TR>
 </form>                
</TABLE>
</center>
</BODY>
</HTML>

